/*
 * @Author: jares
 * @Date: 2024-02-29 10:31:34
 * @LastEditors: jares
 * @LastEditTime: 2024-02-29 16:45:27
 * @Description:
 * 阴影
 * Copyright (c) 2024 by jares, All Rights Reserved.
 */
import { hexToRgb } from '../utils/index.js'

class AreaStyle {
	constructor(options) {
		this.params = hexToRgb(options).join(',') || '117, 242, 194'
		this.color = {}
	}
	init() {
		this.color = {
			type: 'linear',
			x: 0,
			y: 0,
			x2: 0,
			y2: 1,
			colorStops: [
				{
					offset: 0,
					color: `rgba(${this.params}, 1)`
				},
				{
					offset: 1,
					color: `rgba(${this.params}, 0)`
				}
			]
		}
	}
}
const areaStyle = (color) => {
	let o = new AreaStyle(color)
	o.init()
	return o
}
export default areaStyle
